const mongoose = require('mongoose')
const initMerchant = require('@root/initDatas/merchant.json')
const chalk = require('chalk')

const merchantSchema = new mongoose.Schema({
  brand_intros: [
    {
      brief: String,
      image_hash: String,
      name: Object
    },
    {
      brief: String,
      image_hash: String,
      name: Object
    },
    {
      brief: String,
      image_hash: String,
      name: Object
    }
  ],
  cooker_intros: Object,
  header_image: String,
  restaurant_image_hash: Object,
  restaurant_name: Object,
  signature_foods: Object,
  target_url: String,
  title: String,
  video: Object,
  winning_intros: Object
})


const merchantModel = mongoose.model('merchants', merchantSchema)

// 初始化商家信息
// const merchantObj = new merchantModel(initMerchant)
// merchantObj.save((err, data) => {
//   if(err) return console.log(err)
//   console.log("insert merchant successfully...")
// })

module.exports = merchantModel